<?php

class BC_Colorswatch_Model_Config_Attributes
{
    protected $_options;

    public function toOptionArray()
    {
		// $attributes = Mage::getResourceModel('catalog/product_attribute_collection')->addVisibleFilter()->setFrontendInputTypeFilter('select');
		// $attributeArray = array();

		// foreach($attributes as $attribute){
				// $attributeArray[] = array(
					// 'label' => $attribute->getData('frontend_label'),
					// 'value' => $attribute->getData('attribute_code')
				// );
		// }
		
		// //var_dump($attributeArray);exit();
        $read = Mage::getSingleton("core/resource")->getConnection("core_read");
        $select = $read->select()->from(array("a" => "eav_attribute"), array("attribute_id", "frontend_label"))
            ->join(array("ao" => "eav_attribute_option"), "a.attribute_id = ao.attribute_id", array())
            ->order("frontend_label");
        $data = $read->fetchPairs($select);
        if(!$data) return array();
        $options = array();
        foreach($data as $key=>$val)
        {
            $options[] = array(
				'value' => $key,
				'label'	=> $val
			);
        }
        return $options;
    }
}
